<template>
  <div style="padding: 20px;">
    <el-form>
      <el-form-item label="通知标题">
        <el-input v-model="noticeTitle" autocomplete="off" />
      </el-form-item>
      <el-form-item label="通知内容">
        <el-input
          v-model="noticeContent"
          type="textarea"
          :rows="6"
          autocomplete="off"
        />
      </el-form-item>
      <el-form-item label="优先级">
        <el-input v-model="priority" autocomplete="off" />
      </el-form-item>
      <el-select v-model="face" placeholder="请选择面向群体">
        <el-option
          label="全体"
          value="0"
        />
        <el-option
          label="用户"
          value="1"
        />
        <el-option
          label="司机"
          value="2"
        />
      </el-select>
    </el-form>
    <el-button style="margin-top: 20px;" type="primary" @click="addNewNotice">发布通知</el-button>
  </div>
</template>

<script>
import request from '@/utils/request'
export default {
  data() {
    return {
      noticeTitle: '',
      noticeContent: '',
      priority: '',
      face: ''
    }
  },
  methods: {
    addNewNotice() {
      request.post('notice/noticeAdd', {
        'face': this.face,
        'noticeContent': this.noticeContent,
        'noticeTitle': this.noticeTitle,
        'priority': this.priority
      }).then(res => {
        this.noticeTitle = ''
        this.noticeContent = ''
        this.priority = ''
        this.face = ''
        this.$message({
          type: 'info',
          message: `发布成功`
        })
      })
    }
  }
}
</script>

<style>

</style>
